import request from './index.js'

// 宠物相关API
export const petApi = {
  // 获取宠物详情
  getPetById: (id) => {
    return request({
      url: `/pet/${id}`,
      method: 'get'
    })
  },
  
  // 获取用户的宠物列表
  getPetsByUserId: () => {
    return request({
      url: '/pet',
      method: 'get'
    })
  },
  
  // 获取所有宠物视频
  getAllPetVideos: () => {
    return request({
      url: '/pet/videos',
      method: 'get'
    })
  },
  
  // 添加宠物
  addPet: (pet) => {
    return request({
      url: '/pet',
      method: 'post',
      data: pet
    })
  },
  
  // 更新宠物
  updatePet: (id, pet) => {
    return request({
      url: `/pet/${id}`,
      method: 'put',
      data: pet
    })
  },
  
  // 删除宠物
  deletePet: (id) => {
    return request({
      url: `/pet/${id}`,
      method: 'delete'
    })
  }
}

// 导出单个方法，方便直接引用
export function getPetById(id) {
  return petApi.getPetById(id)
}

export function getPetsByUserId() {
  return petApi.getPetsByUserId()
}

export function getAllPetVideos() {
  return petApi.getAllPetVideos()
}

export function addPet(pet) {
  return petApi.addPet(pet)
}

export function updatePet(id, pet) {
  return petApi.updatePet(id, pet)
}

export function deletePet(id) {
  return petApi.deletePet(id)
} 